home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 342_01.zip / DIOFNC05.C < prev    next >
C/C++ Source or Header  |  1993-04-03  |  2KB  |  59 lines

  1. /*-
  2.  *  ----------------------------------------------------------------------
  3.  *  File        :   DIOFNC05.C
  4.  *  Creator     :   Blake Miller
  5.  *  Version     :   01.01.00        February 1991
  6.  *  Language    :   Microsoft C     Version 5.1
  7.  *  Purpose     :   Intel 8255 Compatible Digital IO Functions
  8.  *                  8255 Byte Put Function
  9.  *  ----------------------------------------------------------------------
  10.  *  Revision History:
  11.  *  022891 BVM  :   Change int to short.
  12.  *  070490 BVM  :   Creation
  13.  *  ----------------------------------------------------------------------
  14.  */
  15.  
  16. #define     DIOFNC05_C_DEFINED  1
  17. #include    "DIOLIB.H"
  18. #undef      DIOFNC05_C_DEFINED
  19.  
  20. void dio_put_byte (DIODAT *data, short port, unsigned char p_dat);
  21.  
  22. /*- DIO : Byte Put ---------------------------**
  23.  *  Write one of the bytes in the 8255.
  24.  *  The port number should be 0 - 2 as follows:
  25.  *  Use the defines (DIOLIB.H):
  26.  *  DIO_PORTA = 0 = Port A
  27.  *  DIO_PORTB = 1 = Port B
  28.  *  DIO_PORTC = 2 = Port C
  29.  *  Passed:
  30.  *      pointer         :   DIODAT
  31.  *      short           :   port number
  32.  *      unsigned char   :   port data
  33.  *  Returns:
  34.  *      nothing
  35.  *      Loads stat with any error ID.
  36.  */
  37. void dio_put_byte (DIODAT *data, short port, unsigned char p_dat)
  38.     {
  39.     /*  Make sure the port requested is valid.
  40.      *  Three ports.
  41.      *  The port number should already have zero offset.
  42.      *  Valid port port number = ( 0 - 2 )
  43.      */
  44.     if ( (port < DIO_PORTA) || (port > DIO_PORTC) ){
  45.         data->stat = DIO_ST_BP;
  46.         return;
  47.         }
  48.  
  49.     data->pdat[port] = p_dat;
  50.     dio_bput ( data->base + port, p_dat );
  51.     data->stat = DIO_ST_OK;
  52.     }
  53.  
  54. /*-
  55.  *  ----------------------------------------------------------------------
  56.  *  END DIOFNC05.C Source File
  57.  *  ----------------------------------------------------------------------
  58.  */
  59.